We have used the command transport input ssh. Router is only allowing ssh connections so use command transport 
input telnet or all to solve the issue.